package forJava;

public class ThisTest {

    public static void main(String[] args) {

        new Father();
        new Child();
    }

}

class Father {

    int age = 10;

    public Father() {

        setAge();
        System.out.printf("father构造方法执行... age = %s\n", this.age);
    }

    void setAge() {

        this.age *= 2;

    }

}

class Child extends Father {

    public Child() {

        System.out.printf("Child构造方法执行... age = %s\n", this.age);
    }

    @Override
    void setAge() {

        age *= 3;

    }

}
